{include file="public/layout" /}

<body class="eyou_body_xin">
<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
{include file="system/left" /}
<div id="geduan_div" class="h15"></div>
    <div class="page" style="min-width:auto;margin-left:115px;padding-bottom: 15px;">
        <form method="post" id="handlepost" action="{:url('Shop/conf')}" enctype="multipart/form-data" name="form1">
            <div class="ncap-form-default flexigrid htitx">
                <div class="hDiv"> <div class="hDivBox" style="height: 36px; padding-left: 10px; line-height: 36px;">商城设置</div> </div>
                <dl class="row">
                    <dt class="tit"> <label for="web_name">商城名称</label> </dt>
                    <dd class="opt ui-web_name ui-text">
                        <input id="web_name" name="web[web_name]" value="{$global.web_name|default=''}" class="input-txt ui-input" type="text" data-num="10" />
                        <!-- <p class="ui-big-text none">一般不超过10个字符（<span class="ui-textTips">还可以输入10个字符</span>）</p> -->
                    </dd>
                </dl>
                <dl class="row">
                    <dt class="tit"> <label for="web_logo_wx">商城标识</label> </dt>
                    <dd class="opt">
                        <div class="tab-pane pics" id="tab_proimg">
                            <table class="table table-bordered">
                                <tbody>
                                    <tr>
                                        <td>
                                            <div class="sort-list">
                                                <div class="images_upload" id="web_logo_wx_div" style="width: 100px;{empty name="$global.web_logo_wx"}display: none;{else /}display: block;{/empty}">
                                                    <div class="ic">
                                                        <div class="upimg">
                                                            <div class="icaction" style="display: none;">
                                                                <span class="load_images" id="web_logo_wx_update" onclick="GetUploadify(1, '', 'allimg', 'web_logo_wx_callback');"><i class="iconfont e-bianji2 f-20"></i></span>
                                                            </div>
                                                            <div class="cover-bg" style="display: none;"></div>
                                                            <img id="web_logo_wx_img" src="{$global.web_logo_wx|default=''}">
                                                            <input type="hidden" name="web[web_logo_wx]" id="web_logo_wx" value="{$global.web_logo_wx|default=''}">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <a href="javascript:void(0);" onclick="GetUploadify(1, '', 'allimg', 'web_logo_wx_callback');" class="img-upload mb15" title="点击上传" id="web_logo_wx_a" {notempty name="$global.web_logo_wx"}style="display: none;"{/notempty}> <div class="y-line"></div> <div class="x-line"></div> </a>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </dd>
                </dl>
                <dl class="row">
                    <dt class="tit"> <label for="web_contact">联系方式</label> </dt>
                    <dd class="opt">
                        <input id="web_contact" name="web[web_contact]" value="{$global.web_contact|default=''}" class="input-txt w130" type="text"/>
                        <p class="notic"></p>
                    </dd>
                </dl>
                <dl class="row">
                    <dt class="tit"> <label for="web_work_time">工作时间</label> </dt>
                    <dd class="opt">
                        <input id="web_work_time" name="web[web_work_time]" value="{$global.web_work_time|default=''}" class="input-txt w130" type="text"/>
                        <p class="notic"></p>
                    </dd>
                </dl>
                <dl class="row">
                    <dt class="tit"> <label>技术支持</label> </dt>
                    <dd class="opt">
                        <label class="curpoin"><input id="web_technology_m0" name="web[web_technology_m]" value="0" type="radio" {if condition="!isset($global.web_technology_m) OR empty($global.web_technology_m)"} checked="checked"{/if}>开启</label>
                        &nbsp;
                        <label class="curpoin"><input id="web_technology_m1" name="web[web_technology_m]" value="1" type="radio" {if condition="isset($global.web_technology_m) AND $global.web_technology_m eq 1"} checked="checked"{/if}>关闭</label>
                        <p class="notic">小程序底部版权标识</p>
                    </dd>
                </dl>
                <dl class="row none">
                    <dt class="tit"> <label>电脑端商城</label> </dt>
                    <dd class="opt">
                        <label class="curpoin"><input id="web_status0" name="web[web_status]" value="0" type="radio" {if condition="!isset($global.web_status) OR empty($global.web_status)"} checked="checked"{/if}>开启</label>
                        &nbsp;
                        <label class="curpoin"><input id="web_status1" name="web[web_status]" value="1" type="radio" {if condition="isset($global.web_status) AND $global.web_status eq 1"} checked="checked"{/if}>关闭</label>
                        <input type="hidden" id="old_web_status" value="{$global.web_status|default='0'}">
                        <p class="notic">关闭后，电脑端商城将无法访问</p>
                    </dd>
                </dl>
                {eq name="upgrade" value="true"}
                <dl class="row none">
                    <dt class="tit">
                        <label for="site_url">升级提醒</label>
                    </dt>
                    <dd class="opt">
                        <label class="curpoin" title="第一时间收到系统更新并弹窗提醒"><input type="radio" name="web[web_show_popup_upgrade]" value="1" {if condition='!isset($global.web_show_popup_upgrade) || $global.web_show_popup_upgrade eq 1'}checked="checked"{/if}>开启提示</label>
                        &nbsp;
                        <label class="curpoin" title="仅收到系统更新提醒，静默不弹窗"><input type="radio" name="web[web_show_popup_upgrade]" value="-1" {if condition='isset($global.web_show_popup_upgrade) && $global.web_show_popup_upgrade eq -1'}checked="checked"{/if}>静默模式</label>
                        &nbsp;
                        <label class="curpoin" title="不再收到系统更新提醒"><input type="radio" name="web[web_show_popup_upgrade]" value="2" {if condition='isset($global.web_show_popup_upgrade) && $global.web_show_popup_upgrade eq 2'}checked="checked"{/if}>完全关闭</label>
                        &nbsp;
                        <p class="notic"></p>
                    </dd>
                </dl>
                {/eq}
                <div class="hDiv"> <div class="hDivBox" style="height: 36px; padding-left: 10px; line-height: 36px;">商品设置</div> </div>
                <dl class="row">
                    <dt class="tit"> <label for="goods_unit">商品单位</label> </dt>
                    <dd class="opt">
                        <input id="goods_unit" name="goods[goods_unit]" value="{$usersConfig.goods_unit|default='件'}" class="input-txt w130" type="text"/>
                    </dd>
                </dl>
                <dl class="row">
                    <dt class="tit"> <label for="goods_stock_warning">商品库存预警</label> </dt>
                    <dd class="opt">
                        <input id="goods_stock_warning" name="goods[goods_stock_warning]" value="{$usersConfig.goods_stock_warning|default='0'}" class="input-txt w130" type="text"/><span class="ml10">{$usersConfig.goods_unit}</span>
                    </dd>
                </dl>
                <dl class="row">
                    <dt class="tit"> <label for="goods_stock_deduct">库存扣减</label> </dt>
                    <dd class="opt">
                        <label class="curpoin"><input id="goods_stock_deduct1" name="goods[goods_stock_deduct]" value="1" type="radio" {if condition="isset($usersConfig.goods_stock_deduct) AND $usersConfig.goods_stock_deduct eq 1"} checked="checked"{/if}>付款减库存</label>
                        &nbsp;
                        <label class="curpoin"><input id="goods_stock0" name="goods[goods_stock_deduct]" value="0" type="radio" {if condition="!isset($usersConfig.goods_stock_deduct) OR empty($usersConfig.goods_stock_deduct)"} checked="checked"{/if}>下单减库存</label>
                        <p class="notic"></p>
                    </dd>
                </dl>
                <div class="hDiv"> <div class="hDivBox" style="height: 36px; padding-left: 10px; line-height: 36px;">订单设置</div> </div>
                <dl class="row">
                    <dt class="tit"> <label for="order_unpay_close_time">未付款关闭时间</label> </dt>
                    <dd class="opt">
                        <input id="order_unpay_close_time" name="order[order_unpay_close_time]" value="{$usersConfig.order_unpay_close_time|default='120'}" class="input-txt w130" type="text" /><span class="ml10">分钟</span>
                        <p class="notic">订单创建后多长时间未付款将自动关闭</p>
                    </dd>
                </dl>
                <dl class="row">
                    <dt class="tit"> <label for="order_auto_receipt_time">发货后收货时间</label> </dt>
                    <dd class="opt">
                        <input id="order_auto_receipt_time" name="order[order_auto_receipt_time]" value="{$usersConfig.order_auto_receipt_time|default='7'}" class="input-txt w130" type="text" /><span class="ml10">天</span>
                        <p class="notic">订单发货后自动收货时间</p>
                    </dd>
                </dl>
                <!-- <dl class="row">
                    <dt class="tit"> <label for="order_auto_complete_time">收货后自动完成时间</label> </dt>
                    <dd class="opt">
                        <input id="order_auto_complete_time" name="order[order_auto_complete_time]" value="{$usersConfig.order_auto_complete_time|default='5'}" class="input-txt w130" type="text" data-num="10" /><span class="ml10">天</span>
                        <p class="notic">收货后，多长时间订单自动完成</p>
                    </dd>
                </dl> -->
                <dl class="row">
                    <dt class="tit"> <label for="order_right_protect_time">收货后可维权时间</label> </dt>
                    <dd class="opt">
                        <input id="order_right_protect_time" name="order[order_right_protect_time]" value="{$usersConfig.order_right_protect_time|default='10'}" class="input-txt w130" type="text" /><span class="ml10">天</span>
                        <p class="notic">订单确认收货完成后，多长时间内可申请维权，设置为0则订单不可维权</p>
                    </dd>
                </dl>
                <div class="hDiv"> <div class="hDivBox" style="height: 36px; padding-left: 10px; line-height: 36px;">评价设置</div> </div>
                <dl class="row">
                    <dt class="tit"> <label>订单评价</label> </dt>
                    <dd class="opt">
                        <label> <input type="radio" name="shop[shop_open_comment]" value="1" {if condition="$usersConfig.shop_open_comment == 1"} checked="checked" {/if}/>开启 </label>
                        &nbsp;&nbsp;&nbsp;
                        <label> <input type="radio" name="shop[shop_open_comment]" value="0" {if condition="!isset($usersConfig.shop_open_comment) || empty($usersConfig.shop_open_comment)"} checked="checked" {/if}/>关闭 </label>
                    </dd>
                </dl>
                <dl class="row">
                    <dt class="tit"> <label>评价审核</label> </dt>
                    <dd class="opt">
                        <label> <input type="radio" name="shop[shop_open_comment_audit]" value="1" {if condition="$usersConfig.shop_open_comment_audit == 1"} checked="checked" {/if}/>开启 </label>
                        &nbsp;&nbsp;&nbsp;
                        <label> <input type="radio" name="shop[shop_open_comment_audit]" value="0" {if condition="$usersConfig.shop_open_comment_audit == 0"} checked="checked" {/if}/>关闭 </label>
                    </dd>
                </dl>

                <div class="hDiv"> <div class="hDivBox" style="height: 36px; padding-left: 10px; line-height: 36px;">上传配置</div> </div>
                <dl class="row">
                    <dt class="tit"> <label for="image_type">上传图片格式</label> </dt>
                    <dd class="opt">
                        <textarea rows="5" cols="60" id="image_type" name="basic[image_type]" style="height:20px;">{empty name='global.image_type'}jpg|gif|png|bmp|jpeg|ico|webp{else /}{$global.image_type}{/empty}</textarea>
                    </dd>
                </dl>
                <dl class="row">
                    <dt class="tit"> <label for="media_type">视频格式</label> </dt>
                    <dd class="opt">
                        <textarea rows="5" cols="60" id="media_type" name="basic[media_type]" style="height:20px;">{empty name='global.media_type'}swf|mpg|mp3|rm|rmvb|wmv|wma|wav|mid|mov|mp4{else /}{$global.media_type}{/empty}</textarea>
                    </dd>
                </dl>
                <dl class="row">
                    <dt class="tit"> <label for="file_size">附件上传大小</label> </dt>
                    <dd class="opt">
                        <input id="file_size" name="basic[file_size]" value="{$global.file_size|default=$max_filesize}" type="text" style="width: 60px;" /> {$max_sizeunit}
                        <p class="notic">附件上传大小限制，如果空间不支持，请与空间商联系修改php.ini部分参数</p>
                    </dd>
                </dl>

                <div class="bot"> 
                    <input type="hidden" name="max_filesize" id="max_filesize" value="{$max_filesize}">
                    <input type="hidden" name="max_sizeunit" id="max_sizeunit" value="{$max_sizeunit}">
                    <a href="JavaScript:void(0);" class="ncap-btn-big ncap-btn-green" onclick="formSubmit();">确认提交</a> 
                </div>
            </div>
        </form>
    </div>
</div>

<script type="text/javascript">
    $(function() {
        tipsText();
    });

    function formSubmit(){
        var file_size = parseInt($('#file_size').val());
        var max_filesize = parseInt($('#max_filesize').val());
        var max_sizeunit = $('#max_sizeunit').val();
        if (0 < max_filesize && max_filesize < file_size) {
            showErrorMsg('附件上传大小超过空间的最大限制'+max_filesize+max_sizeunit);
            $('input[name=file_size]').focus();
            return false;
        }

        layer_loading("正在处理");
        $.ajax({
            type : 'post',
            url : "{:url('Shop/conf', ['_ajax'=>1])}",
            data : $('#handlepost').serialize(),
            dataType : 'json',
            success : function(res){
                layer.closeAll();
                if(res.code == 1){
                    layer.msg(res.msg, {time: 1000}, function(){
                        window.location.reload();
                    });
                }else{
                    showErrorMsg(res.msg);
                }
            },
            error: function(e){
                layer.closeAll();
                showErrorAlert(e.responseText);
            }
        });
    }

    // 鼠标事件，加载查看大图和更新图片
    $(document).ready(function() {
        $("#web_logo_wx_div .upimg").live('mouseover', function() {
            $(this).find('div.icaction').show();
            $(this).find('div.cover-bg').show();
        }).live('mouseout', function() {
            $(this).find('div.icaction').hide();
            $(this).find('div.cover-bg').hide();
        });
    });

    // 商品主图回调加载
    function web_logo_wx_callback(paths) {
        $('#web_logo_wx_a').hide();
        $('#web_logo_wx_div').show();
        $('#web_logo_wx_div #web_logo_wx').val(paths);
        $('#web_logo_wx_div #web_logo_wx_img').attr('src', paths);
        $('#web_logo_wx_div #web_logo_wx_update').attr('onclick', "GetUploadify(1, '', 'allimg', 'web_logo_wx_callback');");
    }

</script>

{include file="public/footer" /}
